(function ($){
    'use strict';
    jQuery(document).ready(function () {
        //  preloader
          $(window).on("load",function() {
              $("#loading").delay(0).fadeOut(0);
          });
        // lightcase
            $('a[data-rel^=lightcase]').lightcase();

        // counter up
            $('.counter').counterUp({
                delay: 10,
                time: 1000
            });


            // about slider
            var imageSliderContainer = new Swiper('.image-slider-container', {
                grabCursor: true,
                autoplay: {
                    delay: 5500,
                    disableOnInteraction: false
                },
                navigation: {
                    nextEl: '.image-slide-next-btn',
                    prevEl: '.image-slide-prev-btn'
                },
                pagination: {
                    el: '.swiper-pagination',
                    type: 'progressbar'
                }
            });


            //portfolio-thumb slider
            var portfolioThumbContainer = new Swiper('.portfolio-thumb-container', {
                slidesPerView: 1,
                spaceBetween: 0,
                loop: true,
                autoplay: {
                    delay: 5500,
                    disableOnInteraction: false
                },
                navigation: {
                    nextEl: '.portfolio-thumb-next-btn',
                    prevEl: '.portfolio-thumb-prev-btn'
                }
            });



            var daTestimonialContainer1 = new Swiper('.da-portfolio-swiper-container', {
                loop: true,
                spaceBetween: 60,
                observer: true,
                observeParents: true,
                centeredSlides: true,
                centerSlide: true,
                pagination: {
                    el: '.swiper-pagination',
                    clickable: true,
                    renderBullet: function (index, className) {
                        return '<span class="' + className + '">' + (index + 1) + '</span>';
                    }
                },
                navigation: {
                    nextEl: '.portfolio-next-btn',
                    prevEl: '.portfolio-prev-btn'
                }
            });



            // var datestimonialContainer = new Swiper('.app-testimonial-container1', {
            //     spaceBetween: 10,
            //     slidesPerView: 2,
            //     loop: true,
            //     autoplay: {
            //         delay: 5500,
            //         disableOnInteraction: false
            //     },
            //     breakpoints: {
            //         768: {
            //             slidesPerView: 1,
            //             spaceBetween: 0
            //         }
            //     }
            // });

            var daclientlogoContainer = new Swiper('.da-client-logo-container1', {
                spaceBetween: 30,
                slidesPerView: 5,
                loop: true,
                autoplay: {
                    delay: 5500,
                    disableOnInteraction: false
                },
                breakpoints: {
                    990: {
                        slidesPerView: 4,
                        spaceBetween: 10
                    },
                    768: {
                        slidesPerView: 3,
                        spaceBetween: 10
                    },
                    640: {
                        slidesPerView: 2,
                        spaceBetween: 10
                    },
                    400: {
                        slidesPerView: 1,
                        spaceBetween: 0
                    }
                }
            });


            var datestimonialContainer = new Swiper('.da-testimonial-container1', {
              spaceBetween: 10,
              slidesPerView: 2,
              loop: true,
              autoplay: {
                  delay: 5500,
                  disableOnInteraction: false
              },
              breakpoints: {
                  768: {
                      slidesPerView: 1,
                      spaceBetween: 0
                  }
              }
          });


            // banner slider
          // var bhbannerSliderContainer2 = new Swiper('.bh-banner-slider-container2', {
          //     slidesPerView: 1,
          //     spaceBetween: 0,
          //     grabCursor: true,
          //     loop: true,
          //     autoplay: {
          //         delay: 5500,
          //         disableOnInteraction: false
          //     },
          //     navigation: {
          //         nextEl: '.banner2-slide-next-btn',
          //         prevEl: '.banner2-slide-prev-btn'
          //     }
          //   });








            // // init Isotope
            // jQuery(window).on('load',function() {
            //     var $grid = $('.post-filter-container').isotope({
            //       itemSelector: '.post-element',
            //       layoutMode: 'fitRows',
            //       getSortData: {
            //         name: '.name',
            //         symbol: '.symbol',
            //         number: '.number parseInt',
            //         category: '[data-category]',
            //         weight: function( itemElem ) {
            //           var weight = $( itemElem ).find('.weight').text();
            //           return parseFloat( weight.replace( /[\(\)]/g, '') );
            //         }
            //       }
            //     });

            //     // filter functions
            //     var filterFns = {
            //       // show if number is greater than 50
            //       numberGreaterThan50: function() {
            //         var number = $(this).find('.number').text();
            //         return parseInt( number, 10 ) > 50;
            //       },
            //       // show if name ends with -ium
            //       ium: function() {
            //         var name = $(this).find('.name').text();
            //         return name.match( /ium$/ );
            //       }
            //     };

            //     // bind filter button click
            //     $('#filters').on( 'click', 'li', function() {
            //       var filterValue = $( this ).attr('data-filter');
            //       // use filterFn if matches value
            //       filterValue = filterFns[ filterValue ] || filterValue;
            //       $grid.isotope({ filter: filterValue });
            //     });


            //     // change is-checked class on buttons
            //     $('.button-group').each( function( i, buttonGroup ) {
            //       var $buttonGroup = $( buttonGroup );
            //       $buttonGroup.on( 'click', 'li', function() {
            //         $buttonGroup.find('.is-checked').removeClass('is-checked');
            //         $( this ).addClass('is-checked');
            //       });
            //     });

            // });




            // init Isotope
            jQuery(window).on('load',function() {
                var $grid = $('.bz-project-container').isotope({
                  itemSelector: '.element-item',
                  layoutMode: 'fitRows',
                  getSortData: {
                    name: '.name',
                    symbol: '.symbol',
                    number: '.number parseInt',
                    category: '[data-category]',
                    weight: function( itemElem ) {
                      var weight = $( itemElem ).find('.weight').text();
                      return parseFloat( weight.replace( /[\(\)]/g, '') );
                    },
                  }
                });

                $('.bz-project-container').isotope({
                  itemSelector: '.element-item',
                  percentPosition: true,
                  masonry: {
                    // use outer width of grid-sizer for columnWidth
                    columnWidth: '.project-container-sizer'
                  }
                });

                // filter functions
                var filterFns = {
                  // show if number is greater than 50
                  numberGreaterThan50: function() {
                    var number = $(this).find('.number').text();
                    return parseInt( number, 10 ) > 50;
                  },
                  // show if name ends with -ium
                  ium: function() {
                    var name = $(this).find('.name').text();
                    return name.match( /ium$/ );
                  }
                };

                // bind filter button click
                $('#filters').on( 'click', 'li', function() {
                  var filterValue = $( this ).attr('data-filter');
                  // use filterFn if matches value
                  filterValue = filterFns[ filterValue ] || filterValue;
                  $grid.isotope({ filter: filterValue });
                });


                // change is-checked class on buttons
                $('.button-group').each( function( i, buttonGroup ) {
                  var $buttonGroup = $( buttonGroup );
                  $buttonGroup.on( 'click', 'li', function() {
                    $buttonGroup.find('.is-checked').removeClass('is-checked');
                    $( this ).addClass('is-checked');
                  });
                });

            });


            //menu
            $('.menu-bar').on("click", function(){
                $('body').toggleClass('open-mobile-menu');
            });
            $('.close-bar').on("click", function(){
                $('body').removeClass('open-mobile-menu');
            });
            $('.close-button').on("click", function(){
                $('body').removeClass('open-mobile-menu');
            });


            new WOW().init();



        // search
          $('.search-option').on("click", function(){
            $('body').addClass('search-open');
          })
          $('.close-search').on("click", function(){
            $('body').removeClass('search-open');
          })

            // mobile menu javascript
            $('.mobile-menu>ul>li>a,.mobile-menu ul.mobile-submenu>li>a').on('click', function(e) {
                var element = $(this).parent('li');
                if (element.hasClass('open')) {
                    element.removeClass('open');
                    element.find('li').removeClass('open');
                    element.find('ul').slideUp(1500,"swing");
                }
                else {
                    element.addClass('open');
                    element.children('ul').slideDown(1500,"swing");
                    element.siblings('li').children('ul').slideUp(1500,"swing");
                    element.siblings('li').removeClass('open');
                    element.siblings('li').find('li').removeClass('open');
                    element.siblings('li').find('ul').slideUp(1500,"swing");
                }
            });
            $('.dropdown>a').on('click', function(e){
              e.preventDefault();
            })

            // fixed menu
            $(window).on("scroll",function() {
                var scroll = $(window).scrollTop();

                if (scroll >= 100) {
                    $(".main-menu-area").addClass("fixed-menu slideInDown");
                } else {
                    $(".main-menu-area").removeClass("fixed-menu slideInDown");
                }
            });



             // fixed menu
            // $(window).on("scroll",function() {
            //     var scroll = $(window).scrollTop();

            //     if (scroll >= 100) {
            //         $(".app-main-menu-area").addClass("fixed-totop animate slideInDown");
            //     } else {
            //         $(".app-main-menu-area").removeClass("fixed-totop  animate slideInDown");
            //     }
            // });



            // fixed menu
            $(window).on("scroll",function() {
                var scroll = $(window).scrollTop();

                if (scroll >= 500) {
                    $(".to-top").addClass("fixed-totop");
                } else {
                    $(".to-top").removeClass("fixed-totop");
                }
            });


            // countdown or date & time
            $('#countdown').countdown({
                date: '10/22/2020 17:00:00',
                offset: +2,
                day: 'Day',
                days: 'Days'
            });


            $(".flip-card").flip({
              axis: 'x',
              trigger: 'hover'
            });

    });
})(jQuery);



(function ($){
    'use strict';
    jQuery(document).ready(function () {

      var image = document.getElementsByClassName('thumbnail');
      new simpleParallax(image);
        
    });
})(jQuery);